<?php

namespace app\cps\validate;

use think\Validate;
use app\common\Error;

class Link extends Validate
{
    protected $rule = [
        'id' => 'require',
        'video_id' => 'require',
        'video_detail_id' => 'require',
        'media_id' => 'require',
        'is_open' => 'require',
        'echo_rate' => 'require|between:0,100',
        'advertiser_id' => 'require',
        'company_id' => 'require',
        'account_id' => 'require',
        'rebate' => 'require',
        'status' => 'require',
        'platform' => 'require',
        'type' => 'require',
        'echo_rule_config_id' => 'require',
        // 'recharge_template_id' => 'require',
    ];

    protected $message = [
        'id.require' => Error::ID_NOT_EXIXTS,
        'video_id.require' => Error::VIDEO_ID_NOT_EXIXTS,
        'video_detail_id.require' => Error::VIDEO_DETAIL_ID_NOT_EXIXTS,
        'media_id.require' => Error::MEDIA_ID_NOT_EXIXTS,
        'is_open.require' => Error::IS_OPEN_NOT_EXIXTS,
        'echo_rate.require' => Error::ECHO_RATE_NOT_EXIXTS,
        'echo_rate.between' => Error::ECHO_RATE_INTERVAL_VALUE_ERROR,
        'advertiser_id.require' => Error::ADVERTISER_ID_NOT_EXIXTS,
        'company_id.require' => Error::COMPANY_ID_NOT_EXIXTS,
        'account_id.require' => Error::ACCOUNT_ID_NOT_EXIXTS,
        'rebate.require' => Error::REBATE_NOT_EXISTS,
        'status.require' => Error::STATUS_NOT_EXIXTS,
        'platform.require' => Error::PLEASE_SELECT_LAUNCH_PLATFORM,
        'type.require' => Error::PLEASE_SELECT_TYPE,
        'echo_rule_config_id.require' => Error::PLEASE_SELECT_UPDATE_BACK_SETTING,
        // 'recharge_template_id.require' => Error::PLEASE_SELECT_VIDEO_PAY_SETTING,
    ];

    protected $scene = [
        'add' => ['video_id', 'video_detail_id', 'media_id', 'is_open', 'echo_rule_config_id'],
        'edit' => ['id', 'video_id', 'video_detail_id', 'media_id', 'is_open', 'echo_rule_config_id'],
        'collection' => ['id'],
        'detail' => ['id'],
        'create_account' => ['company_id', 'account_id', 'rebate', 'status', 'platform'],
        'update_account' => ['id', 'company_id', 'account_id', 'rebate', 'status', 'platform'],
        'create_tencent_data_source_id' => ['account_id', 'type'],
    ];
}